﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TravelLib
{
    public class Company
    {
        /// <summary>
        /// Company name
        /// </summary>
        private string _name;
        /// <summary>
        /// List of flights
        /// </summary>
        private List<Flight> _flightList;
        /// <summary>
        /// Name Property
        /// </summary>
        public string CompanyName
        {
            get  { return _name; }
            set  { _name= value; }
        }

        public List<Flight> Flights
        {
            get { return _flightList; }
            set { _flightList = value; }
        }

        public List<FlightWrapper> GetCorrespondingFlights(RouteWrapper route)
        {
            List<FlightWrapper> correspondingFlights = new List<FlightWrapper>();
            foreach (Flight f in _flightList)
            {
                if (f.Route.Includes(route))
                    correspondingFlights.Add(new FlightWrapper(f));
            }
            return correspondingFlights;
        }
    }
}
